﻿<Window x:Class="RegTreeView.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:RegTreeView"
        Title="Registry TreeView" Height="350" Width="525" Loaded="Window_Loaded" Icon="/Images/cog.png">
    <Window.Resources>
        <local:RegItemConverter x:Key="myRegItemConverter"/>
    </Window.Resources>
    <DockPanel LastChildFill="True">
        
        <Grid DockPanel.Dock="Top" Name="grdCurRegInfo" Margin="5">
            <Grid.Resources>
                <Style TargetType="TextBlock">
                    <Setter Property="VerticalAlignment" Value="Center"/>
                </Style>
            </Grid.Resources>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="2*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            
            <Label Grid.Row="0" Grid.Column="0">Hive :</Label>
            <Label Grid.Row="1" Grid.Column="0">Registry Path :</Label>
            <Label Grid.Row="2" Grid.Column="0">Value Name :</Label>
            <Label Grid.Row="3" Grid.Column="0">Value :</Label>
            
            <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=Hive}" ></TextBlock>
            <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Path=RegKeyPath}"></TextBlock>
            <TextBlock Grid.Column="1" Grid.Row="2" Text="{Binding Path=Name}"></TextBlock>
            <TextBlock Grid.Column="1" Grid.Row="3" Text="{Binding Path=Value}"></TextBlock>
            
        </Grid>
    
        <TreeView Name="treeReg" Margin="5" TreeViewItem.Selected="treeReg_Selected">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate DataType="{x:Type local:RegKey}" ItemsSource="{Binding Children}">
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <Image Source="{Binding Converter={StaticResource myRegItemConverter}, Path=IsRegKey}" Width="16" Height="16" SnapsToDevicePixels="True"/>
                            <TextBlock Text="{Binding Path=Name}" Margin="5,0"/>
                        </StackPanel>
                    </StackPanel>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
   
    </DockPanel>

</Window>
